/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.afaker.rss.context;

import java.io.IOException;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author b
 */
public class ResourceContext extends Context{
    public static final String RESOURCE_FILE = "conf/resource.properties";
    private Properties resource;
    private static ResourceContext context;
    private ResourceContext(){
        init();
    }

    private void init() {
        resource = new Properties();
        try {
            resource.load(ResourceContext.class.getClassLoader().getResourceAsStream(RESOURCE_FILE));
        } catch (IOException ex) {
            System.out.println(ex.getMessage());
            Logger.getLogger(ResourceContext.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public static ResourceContext getResourceContext(){
        if(context == null){
            context = new ResourceContext();
        }
        return context;
    }
    public String getProperty(String key){
        return resource.getProperty(key);
    }
}
